WEBVTT

00:00.610 --> 00:06.660
In this video we will create forward looking portfolios and the simplest case is actually the two asset

00:06.780 --> 00:11.300
to stark case and we are still imported the data from the last section.

00:11.300 --> 00:18.910
So for example uh the returns data frame with the the daily returns for our six stocks and the market

00:18.910 --> 00:19.980
portfolio.

00:20.110 --> 00:27.520
And in this video we will focus on the Amazon and the Boeing stock and we created a new data frame two

00:27.520 --> 00:35.510
assets and we can also calculate annualized the risk and return with the user defined function annualized

00:35.510 --> 00:39.200
risk and return and actually be safe.

00:39.200 --> 00:45.590
The summary data frame and the rabbi summary to and now in our next step we want to create a forward

00:45.590 --> 00:52.820
looking portfolio where we have a 60 percent invested in the Amazon stock and 40 percent in the Boeing

00:52.820 --> 00:54.230
stock.

00:54.230 --> 01:00.860
So we create two new variables here and we put also 60 percent and 40 percent and a number higher rate

01:00.870 --> 01:08.950
call it weights W S and now in a very first step we have to calculate the expected portfolio return

01:08.950 --> 01:15.170
of our portfolio consisting of 60 percent Amazon and 40 percent Boeing and therefore we have to predict.

01:15.250 --> 01:20.890
The expected return for Amazon and the we predict here 20 percent.

01:20.890 --> 01:26.980
And we have to predict to the Boeing return the future Boeing return 15 percent and we can also save

01:27.130 --> 01:36.910
those 2 in a panda series so here we are and actually calculating the expected return of our portfolios.

01:36.980 --> 01:37.820
Pretty simple.

01:38.180 --> 01:43.560
So we simply have to calculate uh the weighted average return and therefore we U.S.A.

01:43.580 --> 01:49.790
The weight of Amazon times uh the expected return of Amazon plus the weight of Boeing times.

01:49.860 --> 01:51.940
We expect that the return of Boeing.

01:52.730 --> 01:56.180
And that's exactly what what we are doing here actually.

01:56.330 --> 02:05.230
And uh we get actually the expected return of our portfolio and that is the 18 percent and actually

02:05.230 --> 02:10.200
using this formula is a bit uncomfortable and that's a shortcut.

02:10.270 --> 02:20.470
So we can simply use our a series the expected returns and we use the top method and pass our no higher

02:20.470 --> 02:28.580
rate with our two rates here so that's a matrix multiplication and by doing so we calculate the evaded

02:28.730 --> 02:30.520
average returns.

02:30.620 --> 02:37.820
So here we get to exactly the same result 18 percent and now coming to the more difficult part calculating

02:37.820 --> 02:38.750
the expected.

02:38.840 --> 02:45.860
Portfolio risk and therefore on a very first step we create the covariance matrix of our two assets

02:45.890 --> 02:53.750
and actually the annualized covariance matrix and we save the matrix and the rabbit covariance matrix

02:56.550 --> 02:59.580
so that's an 8 to acid case pretty simple here.

02:59.850 --> 03:02.840
So here we have the variance of the Amazon stock.

03:02.850 --> 03:05.670
Then here we have the variance off of the Boeing stock.

03:06.090 --> 03:13.260
And he and the diagonals we have actually the covariance between those two assets so we could actually

03:13.260 --> 03:17.330
save the variance off the Amazon stock in the variable variance.

03:17.460 --> 03:24.960
Amazon and it's here nine point six percent and the same we can do for the variance of the Boeing stock

03:25.890 --> 03:30.930
and we can also save the covariance between Amazon and Boeing returns.

03:30.930 --> 03:35.970
Also here in a new variable and it should be two point sixty one percent

03:40.780 --> 03:46.830
and now we can calculate the expected risk of our portfolio by simply following the formula here.

03:46.870 --> 03:50.920
So the expected risk of our portfolio is the square root.

03:50.920 --> 03:57.590
And then within the square root we have here the squared the weight of our Amazon stock times.

03:57.670 --> 04:06.100
The variance of the Amazon stock plus the squared weight of Boeing times the variance of uh Boeing stock

04:06.820 --> 04:10.880
and then plus uh two times uh the weight of Amazon times.

04:10.960 --> 04:18.760
The weight of Boeing times the covariance and let's have a look here and we get an expected risk in

04:18.760 --> 04:23.510
standard deviation terms of twenty three point six percent.

04:23.680 --> 04:26.560
And also here that's a pretty helpful shortcut.

04:26.560 --> 04:34.870
So again we take the square root and then we use the covariance matrix and uh we apply here a matrix

04:34.870 --> 04:43.000
multiplication with the top method and we pass uh the weights array and then we assign another matrix

04:43.000 --> 04:45.220
multiplication with the weights array.

04:45.580 --> 04:50.360
So let's uh running the shortcut and uh the results should actually be the same here.

04:50.410 --> 04:55.630
So we get a standard deviation the expected standard deviation of uh twenty three point six percent.

04:56.320 --> 05:02.560
And if you have some spare time you can also check and verify whether this is exactly the same as uh

05:02.590 --> 05:06.490
this here or whether this leads here to the same formula.

05:06.490 --> 05:08.400
So have fun to do so.

05:08.590 --> 05:09.700
And that's actually here now.

05:09.700 --> 05:14.170
The expected return and the expected risk of our forecast the portfolio.

05:14.500 --> 05:20.200
So we have a risk of twenty three percent and a expected return of 18 percent.

05:20.200 --> 05:28.060
So that's uh 1 Uh random or forward looking portfolio and we can also create many random portfolios

05:28.630 --> 05:35.580
and let's assume we want to create 10000 the random portfolios with 10000 random weights.

05:35.890 --> 05:41.830
Then we create here a matrix uh consisting of 10000 rows and two columns.

05:41.830 --> 05:43.330
So 10000 portfolios.

05:43.330 --> 05:48.600
And we have two weights and then we calculate the weights actually.

05:48.600 --> 05:50.730
So here we have our 10000 portfolios.

05:50.730 --> 05:57.120
So the first one for example consisting of seventy point eight percent Amazon and twenty nine point

05:57.270 --> 05:59.740
one percent Boeing.

05:59.760 --> 06:06.750
And then for all of these 10000 random portfolios we can calculate the expected return of these portfolios

06:07.350 --> 06:15.850
by simply using here our panel serious was the expected returns of the two assets and applying the top

06:15.850 --> 06:20.500
method and passing the transposed the weights matrix here.

06:21.070 --> 06:21.870
So let's have a look.

06:26.050 --> 06:34.350
So here we have the returns array consisting of 10000 expected returns for our 10000 random portfolios.

06:34.360 --> 06:41.200
So for example the expected return of the very first portfolio is eighteen point five four percent.

06:41.200 --> 06:47.650
And this is based on a portfolio consisting of seventy point eight percent Amazon stock and twenty nine

06:47.650 --> 06:48.810
point one percent.

06:48.820 --> 06:53.210
Boeing stock and the same we can do also for the risk.

06:53.260 --> 06:57.630
So we take the square root here and within the square root.

06:57.670 --> 06:59.440
This looks a little bit different.

06:59.470 --> 07:01.660
So we have our covariance matrix.

07:01.810 --> 07:09.460
Then we use the top method and pass the transposed weights matrix and then again we multiply with the

07:09.460 --> 07:13.460
weights matrix and then we sum up all rows.

07:13.460 --> 07:15.430
So let's run the cell.

07:15.730 --> 07:24.750
And by doing so we should get the standard deviation of all 10000 random portfolios and we can all say

07:24.850 --> 07:29.670
look here.

07:29.780 --> 07:38.510
So for example the very first portfolio has a standard deviation of twenty five point two 2% and finally

07:38.510 --> 07:43.390
we can also create a summary data frame with the first column.

07:43.430 --> 07:48.200
The returns of the 10000 portfolios and as the second column the risk

07:50.840 --> 07:55.790
so here we have a risk and return for our 10000 random portfolios

07:58.870 --> 08:01.270
and of course we can also visualize them.

08:01.270 --> 08:05.160
So we create a set up plot with on the x axis.

08:05.290 --> 08:10.170
The risk column here and on the y axis the return column.

08:10.360 --> 08:11.510
And we also plot.

08:11.570 --> 08:15.120
We expect that risk and return for our two stocks.

08:15.130 --> 08:16.850
So you see our summary.

08:16.930 --> 08:23.770
To a data frame and take the risk and the expected returns actually of our two constituents and let's

08:23.770 --> 08:24.400
have a look here

08:27.790 --> 08:33.880
and here we have the expected risk and return for Boeing for Amazon and in red we have all possible

08:33.880 --> 08:41.020
combinations of risk and return if we create the portfolios consisting of Amazon and Boeing.

08:41.920 --> 08:48.640
So that's the two asset case and in the next video we will consider the more asset or many asset case

08:49.240 --> 08:51.250
and hope to see there by.
